home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 31 / PC Gamer IT CD 31 1-2.iso / DINKDEMO / dink101.exe / DINK / STORY / ITEM-PIG.C < prev    next >
Text File  |  1997-10-01  |  2KB  |  113 lines

  1. //item pig food
  2.  
  3. void use( void )
  4. {
  5. //disallow diagonal punches
  6.  
  7. if (sp_dir(1, -1) == 1)
  8.     sp_dir(1, 2);
  9. if (sp_dir(1, -1) == 3)
  10.     sp_dir(1, 2);
  11. if (sp_dir(1, -1) == 7)
  12.     sp_dir(1, 8);
  13. if (sp_dir(1, -1) == 9)
  14.     sp_dir(1, 8);
  15.  
  16. &basehit = sp_dir(1, -1);
  17. &basehit += 520;
  18. //520 is the 'base' for the hit animations, we just add
  19. //the direction
  20. sp_seq(1, &basehit);
  21. sp_frame(1, 1); //reset seq to 1st frame
  22. sp_kill_wait(1); //make sure dink will punch right away
  23. sp_nocontrol(1, 1); //dink can't move until anim is done!
  24. wait(250);
  25. playsound(13, 8000,0,0,0);
  26.  
  27.  &mholdx = sp_x(1, -1);
  28.  &mholdy = sp_y(1, -1);
  29.  
  30. if (sp_dir(1, -1) == 4)
  31.   {
  32.   &mholdy -= 37; 
  33.       &mholdx -= 50;
  34.    &junk = create_sprite(&mholdx, &mholdy, 5, 430, 1);
  35.   sp_seq(&junk, 430); 
  36.   }
  37.  
  38. if (sp_dir(1, -1) == 6)
  39.   {
  40.     &mholdy -= 20; 
  41.     &mholdx += 50;
  42.    &junk = create_sprite(&mholdx, &mholdy, 5, 431, 1);
  43.   sp_seq(&junk, 431); 
  44.   }
  45.  
  46. if (sp_dir(1, -1) == 8)
  47.   {
  48.     &mholdy -= 50; 
  49.     &mholdx += 8;
  50.    &junk = create_sprite(&mholdx, &mholdy, 5, 430, 1);
  51.   sp_seq(&junk, 430); 
  52.   }
  53.  
  54. if (sp_dir(1, -1) == 2)
  55.   {
  56.   //  &mholdy += 0; 
  57.     &mholdx -= 2;
  58.    &junk = create_sprite(&mholdx, &mholdy, 5, 431, 1);
  59.   sp_seq(&junk, 431); 
  60.   }
  61.  
  62.  if (&pig_story != 0) return;
  63.  
  64.  if (&player_map == 407)
  65.    {
  66.     //they are feeding the pigs.. maybe...
  67.  
  68. &junk = inside_box(&mholdx,&mholdy, 200, 180, 400, 306);
  69.     if (&junk == 1)
  70.     {
  71.     freeze(1);
  72.      wait(200);
  73.      Say_stop("Come on pigs, eat!", 1);
  74.   //lets create the bully, and run his script
  75.         &junk = create_sprite(680, 200, 0, 341, 1);
  76.         sp_script(&junk, "s1-bul");
  77.  
  78.     }
  79.  
  80.    }
  81.  
  82. }
  83.  
  84. void disarm(void)
  85. {
  86. kill_this_task();
  87. }
  88.  
  89. void arm(void)
  90. {
  91. int &basehit;
  92. int &mholdx;
  93. int &mholdy;
  94. int &junk;
  95.  
  96. preload_seq(522);
  97. preload_seq(524);
  98. preload_seq(526);
  99. preload_seq(528);
  100. preload_seq(430);
  101. preload_seq(431);
  102. }
  103.  
  104. void pickup(void)
  105. {
  106. kill_this_task();
  107. }
  108.  
  109. void drop(void)
  110. {
  111. kill_this_task();
  112. }
  113.